import 'dart:ui';

import 'package:flutter/material.dart';
import 'dart:async';
class LoadingPage extends StatefulWidget{
//  @override
//  State<StatefulWidget> createState() {
//    // TODO: implement createState
//    return new _loadingState();
//  }
  /**
   *  该写法与上面的写法等价的
   */
  @override
  _loadingState createState() =>_loadingState();



}
class _loadingState extends State<LoadingPage>{
  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    //在加载页面停顿3秒
    Future.delayed(Duration(seconds: 3),(){
      print('flutter企业站启动');
      Navigator.pushReplacementNamed(context, "app");
    });
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Center(
      child: Center(
        child: Stack(   //重叠组件
          children: <Widget>[
            //加载启动页面背景图
            Image.asset(
              'assets/images/launch.jpg'
            ),
            Center(
              child: Text(
                  'flutter企业站',
                style: TextStyle(
                  color: Colors.white,
                  fontSize: 36.0,
                  decoration: TextDecoration.none
                ),

              ),
            )
          ],
        ),
      ),
    );
  }
}